#ifndef PFS_FILE_LIST
#define PFS_FILE_LIST
#include <ext/hash_map>
#include <string>
#include "inode.h"
#include "define.h"

using namespace std;

namespace PFS
{
    class FileList
    {
        private:
            typedef hash_map<const char*, INodeFile*, hash<const char*>, str_equal>::iterator ITER;
        public:
            FileList(){}
            virtual ~FileList()
            { file_list.clear();}
            bool add_file(const char* file_name, INodeFile* inode);
            bool exist_file(const char* file_name);

            INodeFile* find_file(const char* file_name);
            INodeFile* replace_file(const char* file_name, INodeFile* new_node);
            void rename_file(const char* old_name, const char* new_name);
            void remove_file(const char* file_name);
        private:
            FileList(const FileList&);
            FileList& operator=(const FileList&);
            hash_map<const char*, INodeFile*, hash<const char*>, str_equal> file_list;
            CMD5 md5;
    };
}

#endif
